#include "cstudent.h"


CStudent::CStudent(QString dbname, QString tbname)
{

    m_db = QSqlDatabase::addDatabase("QSQLITE");
    m_db.setDatabaseName(dbname);
    m_db.open();


    m_tbname = tbname;

}

bool CStudent::addStudent(int id, QString name, QString gender)
{


    QSqlQuery query(m_db);
    query.prepare(QObject::tr("insert into %1 (id,name,gender) values(:id,:name,:gender);").arg(m_tbname));
    query.bindValue(":id",id);
    query.bindValue(":name",name);
    query.bindValue(":gender",gender);

    return query.exec();



}
